﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for UrlBuilder
/// </summary>
public class UrlBuilder
{
    public UrlBuilder()
    {
        //
        // TODO: Add constructor logic here
        //
    }
    public static string location = "http://localhost:7331";
    public static string GetNewsDetail(string TextId, object datetime)
    {
        return "/" + DateTime.Parse(datetime.ToString()).ToString("d/M/yyyy") + "/" + TextId + ".html";
        //return "/Modules/Posts/PostDetail.aspx?PostTextId=" + TextId;
    }
    public static string GetCategory(string TextId)
    {
        return "/category/" + TextId + ".html";
        //return "/Modules/Posts/ListPosts.aspx?CategoryTextId=" + TextId;
    }
    public static string GetCategoryPaging(string TextId)
    {
        return "/category/" + TextId + "/trang-{0}.html";
        //return "/Modules/Posts/ListPosts.aspx?CategoryTextId=" + TextId;
    }
    public static string GetTags(string TextId)
    {
        return "/tags/" + TextId + ".html";
    }
    public static string GetTagsPaging(string TextId)
    {
        return "/tags/" + TextId + "/trang-{0}.html";
    }
    public static string GetAuthor(string Author)
    {
        return "/author/" + Author + ".html";
    }
    public static string GetAuthorPaging(string Author)
    {
        return "/author/" + Author + "/trang-{0}.html";
    }
    public static string GetImage(string Url, int w, int h, bool c)
    {
        if (Url == "")
            Url = "/css/images/noimage.jpg";
        if (c)
            return location + string.Format("/img/w{0}h{1}{2}", w, h, Url);
        return location + string.Format("/img/w{0}h{1}{2}", w, h, Url);
    }
    public static string GetImage(string Url, int w, int h)
    {
        if (Url == "")
            Url = "/css/images/noimage.jpg";
        return location + string.Format("/img/w{0}h{1}{2}", w, h, Url);
    }
    public static string GetImage(string Url, int w)
    {
        if (Url == "")
            Url = "/css/images/noimage.jpg";
        return location + string.Format("/img/w{0}{1}", w, Url);
    }
    //public static string GetImage(string Url)
    //{
    //    return string.Format("{0}", Url);
    //}

    //public static string GetTourListUrl(string TypeTextID)
    //{
    //    return string.Format("/TourList.aspx?TypeTextID={0}", TypeTextID);
    //}
    //public static string GetTourListPagingUrl(string TypeTextID)
    //{

    //    return string.Format("/TourList.aspx?TypeTextID={0}", TypeTextID) + "&page={0}";
    //}
}